package com.example.picturestorage.service;

import com.example.picturestorage.bean.Publisher;
import com.example.picturestorage.mapper.PublisherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
public class PublisherServiceImpl implements PublisherService{

    @Autowired
    private PublisherMapper publisherMapper;

    @Override
    public void addPublisher(Publisher publisher) {
        publisherMapper.addPublisher(publisher);
    }

    @Override
    public List<Publisher> findAllPublisher() {
        return publisherMapper.findAllPublisher();
    }

    @Override
    public List<Publisher> findAllPublisherWithBooks() {
        return publisherMapper.findAllPublisherWithBooks();
    }



    @Override
    public void updatePublisher(String name, Integer id) {
        publisherMapper.updatePublisher(name,id);
    }

    @Override
    public void deletePublisher(Integer id) {
        publisherMapper.deletePublisher(id);
    }

    @Override
    public Publisher findPublisherById(Integer id) {
        return publisherMapper.findPublisherById(id);
    }

    @Override
    public Publisher findPublisherByName(String name) {
        return publisherMapper.findPublisherByName(name);
    }

    @Override
    public int insertPublishers(List<Publisher> publishers){
        return publisherMapper.insertPublishers(publishers);
    }

}
